package cn.livingCloud.dto;

import cn.livingCloud.entity.core.PushGroup;
import cn.livingCloud.entity.core.ReportRule;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by DingJie on 2016/6/21.
 */
public class PushGroupFormDto extends PushGroupDto {
    private String reportRuleUuid;
    private List<ReportRuleDto> reportRuleDtos = new ArrayList<>();

    public PushGroupFormDto() {
    }

    public PushGroupFormDto(PushGroup item) {
        super(item);
        this.reportRuleUuid = item.getReportRuleUuid();
    }

    public PushGroupFormDto(List<ReportRule> listReportRule) {
        for (ReportRule reportRule : listReportRule) {
            this.reportRuleDtos.add(new ReportRuleDto(reportRule));
        }
    }

    public PushGroupFormDto(PushGroup pushGroup, List<ReportRule> listReportRule) {
        super(pushGroup);
        this.reportRuleUuid = pushGroup.getReportRuleUuid();
        for (ReportRule reportRule : listReportRule) {
            this.reportRuleDtos.add(new ReportRuleDto(reportRule));
        }
    }

    public DefaultCronExpression[] getAllCronExpression() {
        return DefaultCronExpression.values();
    }

    @Override
    public String getReportRuleUuid() {
        return reportRuleUuid;
    }

    @Override
    public void setReportRuleUuid(String reportRuleUuid) {
        this.reportRuleUuid = reportRuleUuid;
    }

    public List<ReportRuleDto> getReportRuleDtos() {
        return reportRuleDtos;
    }

    public void setReportRuleDtos(List<ReportRuleDto> reportRuleDtos) {
        this.reportRuleDtos = reportRuleDtos;
    }
}
